﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using SqlSugar;
namespace furion.blog.Domain.MySQL
{
    /// <summary>
    /// 
    ///</summary>

    [SplitTable(SplitType.Day)]//按年分表 （自带分表支持 年、季、月、周、日）
    [SugarTable("request_log_{year}{month}{day}")]//生成表名格式 3个变量必须要有
    public class RequestLog
    {
        /// <summary>
        ///  
        ///</summary>
         [SugarColumn(ColumnName="log_id" ,IsPrimaryKey = true ,ColumnDataType = "bigint(20)"  )]
         public long LogId { get; set; }
        /// <summary>
        /// 请求IP 
        ///</summary>
         [SugarColumn(ColumnName="ip"  ,ColumnDataType = "varchar(50)"  )]
         public string Ip { get; set; }
        /// <summary>
        /// ip所属地址 
        ///</summary>
         [SugarColumn(ColumnName="source_addr" , ColumnDataType = "varchar(128)"   )]
         public string SourceAddr { get; set; }
        /// <summary>
        /// 请求地址 
        ///</summary>
         [SugarColumn(ColumnName="url" , ColumnDataType = "varchar(255)"   )]
         public string Url { get; set; }
        /// <summary>
        /// body参数 
        ///</summary>
         [SugarColumn(ColumnName="body" ,ColumnDataType = "text"   )]
         public string Body { get; set; }
        /// <summary>
        /// User(后端账号)  Member(会员)  Unknow(未登录) 
        ///</summary>
         [SugarColumn(ColumnName="role"  ,ColumnDataType = "char(10)"  )]
         public string? Role { get; set; }
        /// <summary>
        /// 请求返回结果 
        ///</summary>
         [SugarColumn(ColumnName="result"  ,ColumnDataType = "text"  )]
         public string Result { get; set; }
        /// <summary>
        /// 请求耗时(单位：毫秒) 
        ///</summary>
         [SugarColumn(ColumnName="used_time" ,ColumnDataType = "int(11)"   )]
         public long? UsedTime { get; set; }
        /// <summary>
        /// 创建时间(请求时间) 
        ///</summary>
        [SugarColumn(ColumnName="created_time" , ColumnDataType = "datetime"   )]
        [SplitField]
        public DateTime? CreatedTime { get; set; }
        /// <summary>
        /// 请求方式
        /// </summary>
        [SugarColumn(ColumnName = "request_method",ColumnDataType ="char(10)")]
        public string RequestMethod { get; set; }
        /// <summary>
        /// 客户端系统
        /// </summary>
        [SugarColumn(ColumnName = "os_info",ColumnDataType = "text")]
        public string OSInfo { get; set; }
        /// <summary>
        /// 操作人员ID(user 或者 member)
        /// </summary>
        [SugarColumn(ColumnName = "uid",ColumnDataType = "bigint(20)")]
        public long? Uid { get; set; }
        /// <summary>
        /// 调用方法
        /// </summary>
        [SugarColumn(ColumnName = "execute_method",ColumnDataType ="varchar(255)")]
        public string ExecuteMethod { get; set; }
        /// <summary>
        /// 接口名称
        /// </summary>
        [SugarColumn(ColumnName = "api_name",ColumnDataType ="varchar(50)")]
        public string ApiName { get; set; }
        /// <summary>
        /// 接口描述
        /// </summary>
        [SugarColumn(ColumnName = "api_desc",ColumnDataType ="varchar(255)")]
        public string ApiDesc { get; set; }
    }
}
